package com.wthink.hzgj.busplan

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.navigation.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
import com.wthink.hzgj.R
import com.wthink.hzgj.business.viewmodel.BusinessViewModel
import com.wthink.hzgj.busplan.adapter.BusPlanAdapter
import com.wthink.hzgj.busplan.viewmodel.BusPlanModel
import com.wthink.hzgj.copyFile.adapter.CameraListCheckAdapter
import com.wthink.hzgj.databinding.FragmentBusPlanBinding
import com.wthink.hzgj.databinding.FragmentBusinessBinding
import com.wthink.hzgj.util.adapter.BaseViewHolder


class BusPlanFragment : Fragment(){

    private val viewModel by viewModels<BusPlanModel>()

    private lateinit var binding: FragmentBusPlanBinding


    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        binding = DataBindingUtil.inflate(
            inflater,
            R.layout.fragment_bus_plan,
            container,
            false
        )
        binding.viewModel = viewModel
        binding.lifecycleOwner = this

        return binding.root
    }

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        binding.back.setOnClickListener {
            it.findNavController().popBackStack()
        }

        binding.busPlanRecycler.layoutManager = LinearLayoutManager(context,
            LinearLayoutManager.VERTICAL,false)

        binding.busPlanRecycler.adapter = object : BusPlanAdapter(){
            override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
                super.onBindViewHolder(holder, position)
                val itemView = holder.itemView
            }
        }



        viewModel.reqLine()
    }
}